﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Hyt.Core
{
    /// <summary>
    /// 数据持久化服务
    /// </summary>
    public interface IPersistService : IPartOfWork
    {
        IQueryable<T> GetQuery<T>(QueryOption<T> option = null) where T : class;
        T Get<T>(params object[] keys) where T : class;
        int ExecuteSqlCommand(string sql, params object[] parameters);
        IEnumerator<T> ExecuteSqlQuery<T>(string sql, params object[] parameters);

        T Add<T>(T model) where T : class;
        void Update<T>(T model) where T : class;
        void AddOrUpdate<T>(params T[] models) where T : class;
        void Remove<T>(T model) where T : class;
        EntityState GetStatus<T>(T model) where T : class;
        void SetStatus<T>(T model,EntityState state) where T : class;
    }
}
